#include <ximera/graphics/ogre/world.hpp>
#include <ximera/graphics/ogre/camera.hpp>
#include <ximera/graphics/ogre/graphicssystem.hpp>
#include <ximera/graphics/ogre/viewport.hpp>
#include <ximera/graphics/ogre/scenenode.hpp>
#include <ximera/graphics/ogre/light.hpp>
#include <ximera/graphics/ogre/entity.hpp>
#include <ximera/graphics/ogre/particlesystem.hpp>

namespace ximera { namespace graphics { namespace ogre 
{
    World::World(GraphicsSystem* graphicsSystem)
        : _graphicsSystem(graphicsSystem)          
    {
        _rootNode.reset(new SceneNode(this, graphicsSystem, L"root"));
    }

    SharedPtr<ISceneNode> const& World::rootNode()
    {
        return _rootNode;
    }

    void World::loadFromFile(String const& file)
    {
        loadOSMFromFile(file);
    }

    ILight* World::createLight(String const& name)
    {
        return new Light(_graphicsSystem->ogreSceneManager(), name);
    }

    ICamera* World::createCamera(String const& name)
    {
        return new Camera(_graphicsSystem->ogreSceneManager(), name);
    }

    IViewport* World::createViewport(ICamera* camera)
    {
        return new Viewport(_graphicsSystem, static_cast<Camera*>(camera));
    }

    IEntity* World::createEntity(String const& name, PrefabEntityType type)
    {
        return new Entity(_graphicsSystem->ogreSceneManager(), name, type);
    }

    IEntity* World::createEntity(String const& name, String const& meshName)
    {
        return new Entity(_graphicsSystem->ogreSceneManager(), name, meshName);
    }

    IParticleSystem* World::createParticleSystem(String const& name, String const& templateName)
    {
        return new ParticleSystem(_graphicsSystem->ogreSceneManager(), name, templateName);
    }

    void World::loadOSMFromFile(String const& file)
    {
    }
}}}